What is the Big-Oh nitation for this? [closed]
Posted
by
laniam
on Programmers
See other posts from Programmers
or by laniam
Published on 2012-10-23T01:21:16Z
Indexed on
2012/10/23
5:25 UTC
Read the original article
Hit count: 145
algorithms
procedure quartersearch (x : inter, a1, a2, ?, an) : increasing integers)
i := 1{i is left endpoint of search interval} ?
j := n {j is right endpoint of search interval}
while i < j
begin
m :=? ?(i + j)? / 4
if x > am then ?i := m+1
else if x > am then ?m : = ?(i + j)? / 4
else if x > am then m := 2 ?(i + j)? /4
else ?if x > am then m := 3 ?(i + j)? /4
else j := m
end
if x = ai then location := i
else location := 0
© Programmers or respective owner